<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/easyui/themes/metro/easyui.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/icon.css" />
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/easyui/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
   <!-- 搜索开始 -->
   <div class="easyui-panel" style="margin-bottom: 2px;text-align: center;padding: 10px" data-options="title:'查询条件',iconCls:'icon-search',width:'100%'">
		<form action="#" method="post" id="searchFrm">
			<input class="easyui-textbox"  name="identity"  labelAlign="center" label="身份证号:" labelPosition="left" style="width:40%;">		
			<input class="easyui-textbox"  name="custname"  labelAlign="center"  label="客户姓名:" labelPosition="left" style="width:40%;">	
			<div style="height: 5px"></div>
			<input class="easyui-textbox"  name="address"  labelAlign="center"  label="客户地址:" labelPosition="left" style="width:40%;">		
			<input class="easyui-textbox"  name="phone"   labelAlign="center"  label="客户电话:" labelPosition="left" style="width:40%;">		
			<div style="height: 5px"></div>
			<div style="text-align: center;">
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="doSearch()" iconCls="icon-search">查询</a>
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#searchFrm').form('clear')" iconCls="icon-reload">重置</a>
			</div>
		</form>			
	</div>
   <!-- 搜索结束-->
    
    <!-- 数据表格开始 -->
     <table id="dg" class="easyui-datagrid"></table>
     <div id="toolbar">
     	<shiro:hasPermission name="user:create">
        	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newCustomer()">添加客户</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="user:update">
       		 <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editCustomer()">修改客户</a>
         </shiro:hasPermission>
        <shiro:hasPermission name="user:delete">
        	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyCustomer()">删除客户</a>
         </shiro:hasPermission>
        <shiro:hasPermission name="user:export">
        	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-page-excel" plain="true" onclick="exportCustomer()">导出客户</a>
  		 </shiro:hasPermission>
</div>
    <!-- 数据表格结束 -->
   
    <script type="text/javascript">
    	//加载表格数据
    	$("#dg").datagrid({
			title:'用户列表',//标题
			width:'100%',//宽度
			height:'350px',//高度
			iconCls:'icon-save',//图标
			fitColumns:true,// 是否动分配列宽
			singleSelect:true,// 是否支持单行选中
			rownumbers:true,// 是否显示行号
			url:'${pageContext.request.contextPath}/user/loadAllUsers.action',//json数据地址
			toolbar:'#toolbar',//工具栏
		    columns:[[//对url传回的json数据的解析
			           {field:'id',title:'ID',width:100,align:'center'},
			           {field:'username',title:'姓名',width:100,align:'center'},
			           {field:'address',title:'地址',width:100,align:'center'}
			       ]]
		});

    </script>
</body>
</html>